﻿using System;
using System.Windows.Forms;
using docNET.Resources;

namespace docNET.Common
{
	class DnMessageBox
	{
		/// <summary>
		/// Displays a message box with the specified message and exception depending on settings.
		/// </summary>
		/// <param name="text">Text to show in the message box.</param>
		/// <param name="icon">Icon to show in the message box.</param>
		/// <param name="e">Exception to embed in the text if turned on in the settings.</param>
		/// <returns></returns>
		public static DialogResult Show(string text, MessageBoxIcon icon, Exception e)
		{
			if (Current.showExceptions && e != null)
				text = string.Format("{0}{1}", text, string.Format(@Messages.ExceptionSuffix, e.Message));

			return MessageBox.Show(text, Helper.GetAppName(), MessageBoxButtons.OK, icon, MessageBoxDefaultButton.Button1);
		}

		/// <summary>
		/// Displays a message box with the specified message.
		/// </summary>
		/// <param name="text">Text to show in the message box.</param>
		/// <param name="icon">Icon to show in the message box.</param>
		/// <returns></returns>
		public static DialogResult Show(string text, MessageBoxIcon icon)
		{
			return DnMessageBox.Show(text, icon, null);
		}
	}
}
